import 'package:appflutterhomeschool/model/tab_model.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';

import '../my_app_view_model.dart';

///用户： ninetailedfox
///时间： 2020/7/3
///邮箱： 1037438704@qq.com
///功能： 课程详情状态管理
class CoureDetailsViewModel extends ChangeNotifier {
  bool identity;
  List<TabModel> listTab = [
    TabModel("课程详情", true),
  ];

  int getIndex = 0;
  BuildContext me;

  CoureDetailsViewModel(this.me);

  initView() {
    MyAppViewModel myAppViewModel = Provider.of<MyAppViewModel>(me);
    identity = myAppViewModel.identity;
    if (!identity) {
      listTab.add(TabModel("课程目录", false));
    }
    notifyListeners();
  }

  tapModelOnTap(int index) {
    for (int i = 0; i < listTab.length; i++) {
      listTab[i].display = false;
    }
    listTab[index].display = true;
    getIndex = index;
    notifyListeners();
  }
}
